import Vue from 'vue'
import App from './App'
import Util from './utils/util.js'

import table from './components/p-table/table/table.vue'

Vue.component('m-table',table)
//使用colorUI 自定义导航栏
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)
//自定义底部导航栏

// 注册全局组件
import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"
Vue.component('mescroll-body', MescrollBody)
Vue.component('mescroll-uni', MescrollUni)


Vue.config.productionTip = false

const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}

/**
 * 按钮全新控制
 *authorities 多个用,号隔开
 * v-show="hasAuthority('systemUserCreate')"
 * v-show="hasAuthority('systemUserCreate,systemUserUpdate,')"
 * @param authorities
 * @returns {boolean}
 */
Vue.prototype.hasAuthority = function (authorities) {
  if (!authorities) {
    return falseUserName
  }
  return authorities.split(',').some(item => {
    return Util.getUserInfo().access.includes("ACTION_"+item)
  })
}

Vue.prototype.$msg = msg;

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
